%if defined('login'):
    %include Base/header name=login
%else:
    %include Base/header
%end
        <div class="col-md-9">
            <div id="createforms" class="jumbotron-logrus" style="display:none">
                  <form enctype="multipart/form-data" role="form" action="/bugreport/add" method="post" accept-charset="utf-8">
                       <div class="form-group">
                        <input type="text" name="theme" class="form-control" placeholder="Название">
                       </div>
                      <input type="file" name="data" multiple>
                      <hr>
                      <textarea id="block" name="text" class="form-control" rows="3" style="width:98%; height:250px"></textarea>
                      <hr>
                                 <button class="btn btn-primary btn-sm" type="submit">Создать</button>
                                 <div class="btn btn-primary btn-sm" onclick=changewieverblock("content")>Отменить</div>
                  </form>

            </div>
            <div id="content" class="jumbotron-logrus" style="display:block">
                        <button type="submit" onclick=wieverblock("hideform") class="btn btn-primary btn-sm">Поиск</button>
                        %if defined('login'):
                            <button type="submit" onclick=changewieverblock("createforms") class="btn btn-primary btn-sm">Создать</button>
                        %end
                        <hr>
                    <div id="hideform" style="display: none">
                        <form enctype="multipart/form-data" class="form-inline" action="/bugreport/search" method="post" accept-charset="utf-8">
                            <div class="form-group">
                                <input type="text" name="id" class="form-control" placeholder="id">
                            </div>
                            <div class="form-group">
                                <input type="text" name="user" class="form-control" placeholder="Username">
                            </div>
                            <div class="form-group">
                            <input type="text" name="name" class="form-control" placeholder="Название">
                            </div>
                            <div class="form-group">
                            <select name="status" class="select-logrus">
                                <option>all</option>
                                <option>open</option>
                                <option>close</option>
                                <option>inprogress</option>
                                <option>delay</option>
                            </select>
                            </div>
                            <div class="form-group">
                            <button type="submit" class="btn btn-default">Найти</button>
                            </div>
                            <hr>
                        </form>
                    </div>
                <table class="table table-hover">
                    <thead>
                    <tr>
                        <th>id</th>
                        <th>Название</th>
                        <th>Дата создания</th>
                        <th>Состояние</th>
                        <th>Пользователь</th>
                    </tr>
                    </thead>
                   <tbody>
                    %if defined('bugreports'):
                      %for bugreport in bugreports:
                       %if bugreport[3]=='open': status= "success"
                       %elif bugreport[3]=='close': status="danger"
                       %elif bugreport[3]=='inprogress':status="warning"
                       %elif bugreport[3]=='delay': status="active"
                       <tr class={{status}} onclick="window.location ='/bugreport_{{bugreport[0]}}' ">
                       <td>{{bugreport[0]}}</td>
                       <td>{{bugreport[1]}}</td>
                       <td>{{bugreport[2]}}</td>
                       <td>{{bugreport[3]}}</td>
                       <td>{{bugreport[4]}}</td>
                       </tr>
                      %end
                    %end
                    </tbody>
                </table>
            </div>
         </div>
        </div>
     </div>
    </div>
   </div>

%include Base/footer